package cn.wx.jove.core.service;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.wx.jove.core.entity.Vitualcoin;
import cn.wx.common.persistence.base.BaseService;
import cn.wx.jove.core.mapper.VitualcoinMapper;
import cn.wx.common.persistence.exception.MyException;
import cn.wx.common.persistence.web.ResponseCode;


/**
 * <p>
 *  服务类
 * </p>
 *
 * @author  
 * @since 2018-12-14
 */
@Service
@Transactional
public class VitualcoinService extends BaseService<Vitualcoin, VitualcoinMapper> {

	/**
	 * 新增
	 * @param vitualcoin
	 * @return
	 * @throws MyException 
	 */
	 public boolean create(Vitualcoin vitualcoin) throws MyException{
	 	return insert(vitualcoin);
	 }
	 
	 /**
	 * 修改
	 * @param vitualcoin
	 * @return
	 * @throws MyException 
	 */
	public boolean modify(Vitualcoin vitualcoin) throws MyException{
		// PID 不能为空
		if (vitualcoin.getpId() == null) {
			throw new MyException(ResponseCode.PARAMETER_REQUIRED);
		}
		return update(vitualcoin);
	}

	public Vitualcoin queryMax() {
		return simpleMapper.queryMax();
	}
	
	/**
	 * 删除
	 * @param vitualcoin
	 * @return
	 * @throws MyException 
	 */
//	public boolean remove(Vitualcoin vitualcoin) throws MyException{
//		// PID 不能为空
//		if (vitualcoin.getpId() == null) {
//			throw new MyException(ResponseCode.PARAMETER_REQUIRED);
//		}
//		vitualcoin.setfRemove(true);
//		return update(vitualcoin);
//	}
}
